package com.fjb.config;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fjb.common.entity.HttpCode;
import com.fjb.common.entity.JsonResult;

@ControllerAdvice
public class GlobalExceptionHandler {
	
 	@ExceptionHandler
    @ResponseBody
    public JsonResult<String> exceptionHandler(Exception e, HttpServletResponse response) {
        // 记录日志
        e.printStackTrace();
        return new JsonResult<String>(null, HttpCode.EXCEPTIONS);
    }
	
}
